package com.yy.satokenapplication.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.time.LocalDateTime;
import java.util.List;

@Data
@TableName("sys_user")
@NoArgsConstructor
public class SysUser implements java.io.Serializable {
    @Serial
    private static final long serialVersionUID = -1291541503453934539L;
    @TableId(type = IdType.AUTO)
    private Long id;
    
    private String username;
    
    private String password;
    
    private String realName;
    
    private String email;
    
    private String phone;
    
    private Integer status;
    
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
    
    @TableLogic
    private Integer deleted;
    
    @TableField(exist = false)
    private List<SysPermission> permissionsList;


    @TableField(exist = false)
    private List<SysRole> rolesList;

    public SysUser(Long id, List<SysPermission> permissionsList, List<SysRole> rolesList) {
        this.id = id;
        this.permissionsList = permissionsList;
        this.rolesList = rolesList;
    }
} 